﻿@namespace Code.Shared

@inherits CodeComponentBase
<div style="width: 260px;float: left;" >
    <MExpansionPanels Dark="LayoutOptions.Dark" Class="mb-6">
        <MExpansionPanel  >
            <MExpansionPanelHeader  ExpandIcon="mdi-menu-down">
                文件管理器
            </MExpansionPanelHeader>
            <MExpansionPanelContent  Style="overflow: auto;height: 600px;">
                <FileTree></FileTree>
            </MExpansionPanelContent>
        </MExpansionPanel >
        <MExpansionPanel>
            <MExpansionPanelHeader ExpandIcon="mdi-menu-down">
                关于
            </MExpansionPanelHeader>
            <MExpansionPanelContent>
                <RegardingOur></RegardingOur>
            </MExpansionPanelContent>
        </MExpansionPanel>
    </MExpansionPanels>
</div>
<div class="tab">
    <MCard Dark="LayoutOptions.Dark" Style="height: 93%;">
        <MTabs
            Dark="LayoutOptions.Dark"
            @bind-Value="@selectTabModel"
            BackgroundColor="primary"
            CenterActive>
            @foreach (var t in Tabs)
            {
                <MTab Value="@t.Key">
                    @t.Name
                    <MIcon Dark="LayoutOptions.Dark" Small OnClick="async () =>await CloseFile(t)">mdi-close</MIcon>
                </MTab>
            }
        </MTabs>
        <MTabsItems @bind-Value="selectTabModel" Style="height: 100%;">
            @foreach (var t in Tabs)
            {
                <MTabItem
                    Value="t.Key" Style="height: 100%;">
                    @switch (t.Type)
                    {
                        case TabType.Edit:
                            <MonacoEdit Key="@Guid.NewGuid().ToString("N")" Parameters="@t?.Parameters" Path="@t.Parameters["Path"].ToString()" ></MonacoEdit>
                            break;
                        case TabType.Component:
                            <DynamicComponent Type="@(t.Data as Type)" Parameters="@t.Parameters"></DynamicComponent>
                            break;
                        default:
                            <div>首页</div>
                            break;
                    }
                </MTabItem>
            }
        </MTabsItems>
    </MCard>
</div>

<style>
.tab{
    float: left;
    width: calc(100% - 260px);
    height: 100%;
    max-height: calc(100vh - 25px);
}

</style>